{extend name="index_layout"/}
{block name="main"}
<form class="layui-form" method="post">
    <input type="hidden" name="id" value="{$data.id}">
    <input type="hidden" name="yfcm_id" value="{$yfcm_id}">

    <div class="layui-form-item">
        <label class="layui-form-label">省/直辖市</label>
        <div class="layui-input-block">
            <select name="province" lay-verify="required"  lay-filter="ccc6">
                <option value="">请选择省</option>
                {volist name="proviec" id="vo"}
                <option value="{$vo.id}">{$vo.name}</option>
                {/volist}
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">市</label>
        <div class="layui-input-block">
            <select id="c-city" name="city"  lay-filter="c-city">
                <option value="">请选择市</option>
            </select>
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">满减包邮</label>
        <div class="layui-input-block">
            <input type="text" name="mj_by" lay-verify="required" value="{$data.mj_by}" autocomplete="off" placeholder="满减金额"
                   class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">邮费</label>
        <div class="layui-input-block">
            <input type="text" name="y_fee" value="{$data.y_fee}" lay-verify="required|number" autocomplete="off" placeholder="邮费"
                   class="layui-input">
        </div>
    </div>


    <div class="layui-form-item layer-footer">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
{/block}
{block name="script"}
<script type="text/javascript">
    layui.use(['form', 'yznForm'], function () {
        var yznForm = layui.yznForm;
        var form = layui.form;
        yznForm.bindevent($("form.layui-form"));
        form.on('select(ccc6)', function (data) {
            $.ajax({
                type: "POST",//规定传输方式
                url: "{:url('getc_cate')}",//提交URL
                data: {'id': data.value},//提交的数据
                success: function (result) {
                    if (result.code == 200) {
                        $("#c-city").empty();
                        var str = "<option value>请选择市</option>";
                        $.each(result.data, function (i, val) {
                            str += '<option value=' + val.id + '>' + val.name + '</option>'
                        });
                        $("#c-city").append(str);
                        layui.form.render('select');
                    }
                },
                error: function () {
                    alert("获取信息失败")
                }
            });
            form.render();
        });
    });
</script>
{/block}